package com.bestcem.xm.common.core.domain.web;


import com.bestcem.bp.grpc.v1.base.Code;
import com.bestcem.bp.grpc.v1.base.Status;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * @author None from pay
 * 最后更新时间: 2021年6月4日15:05:55
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class RpcStatusResult {

    private static final Status SUCCESS;

    static {
        Status.Builder status = Status.newBuilder();
        status.setMessage("Success");
        status.setCode(Code.OK);
        SUCCESS = status.build();
    }

    public static Status success() {
        return SUCCESS;
    }

    public static Status error(String message) {
        Status.Builder status = Status.newBuilder();
        status.setMessage(message);
        status.setCode(Code.ERROR);
        return status.build();
    }
}
